efform_onload = function (){
	var year=$('#inqu_status-0-year',window.parent.document).val();
	var month=$('#inqu_status-0-month',window.parent.document).val();
	$('#inqu_status-0-fdYear').val(year);
	$('#inqu_status-0-fdMonth').val(month);
}; 
button_insert_onclick = function (){
	if (isSelected("ef_grid_r") == 0)return; 
	efgrid.submitForm( "ef_grid_r", "ZM","ZMCN43","insert",true);
}

button_update_onclick = function (){
	if (isSelected("ef_grid_r") == 0)return; 
	efgrid.submitForm( "ef_grid_r", "ZM","ZMCN43","update",true);
}

button_delete_onclick = function (){
	var grid=isSelected("ef_grid_r");
	if (grid == 0)return; 
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r)efgrid.submitForm( "ef_grid_r", "ZM","ZMCN43","delete",true);
	}); 
}
button_report_onclick = function (){
	var grid=isSelected("ef_grid_r");
	if (grid == 0)return; 
	var rows=grid.getCheckedRows();
	for(var i=0;i<rows.length;i++)
	{
		if(grid.getCellValueByColumnName(rows[i],"fdStatus")!="草拟")
		{
			EFAlert("该记录或有记录已经上报！"); return;
		}
	}
	EFConfirm('你确认要上报吗?', '确认框', function(r) {
		if(r)efgrid.submitForm( "ef_grid_r", "ZM","ZMCN43","report",true);
	}); 
}
efgrid_afterAddNewRow = function(grid_id){ 
	var grid = efgrid.getGridObject(grid_id);
	var rows = grid.getCheckedRows();  
	if(grid_id=="ef_grid_r")
	{
		for(var i = 0 ; i < rows.length;i++){
			grid.getBlockData().setCell(rows[i], "fdStatus", "草拟");
			grid.getBlockData().setCell(rows[i], "fdKeyId", "");
		}
	}
}
button_print_onclick = function() {
	var fdYear = $('#inqu_status-0-fdYear').val();
	var fdMonth = $('#inqu_status-0-fdMonth').val();
	// 取报表参数
	var param = [];
	param.year =fdYear;
	param.month =fdMonth;
	var reportEname = "MZJCJG";
	try {
		previewReport(reportEname,param);
	} catch (e) {
		alert("控件加载失败，请确认控件是否正确安装并将本网站设为信任地址");
	}
}
//ZMCN43将MJ/kg转换为kcal/kg
efgrid_onDataCellSaved = function( grid_id, row_index, col_index, cell_value ) 
{
	var grid = efgrid.getGridObject( grid_id ); 
	if( col_index == 9){
		var fdMyQnet=grid.getCellValueByColumnName(row_index, "fdMyQnet"); // Qnet,v,ar(MJ/kg)
		var fdMyQnetk=calculate(fdMyQnet); //Qnet,v,ar(kcal/kg)
		grid.getBlockData().setCell(row_index, "fdMyQnetk", fdMyQnetk);
		grid.refreshCell( row_index, 10 , TYPE_DATA );
	}
}
